package sample.two.server;

import java.io.IOException;
import java.net.InetSocketAddress;

import org.apache.mina.core.service.IoAcceptor;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.filter.codec.ProtocolCodecFilter;
import org.apache.mina.filter.codec.textline.TextLineCodecFactory;
import org.apache.mina.filter.logging.LoggingFilter;
import org.apache.mina.transport.socket.nio.NioSocketAcceptor;

import com.syt.mina.filter.codec.flex.AMF3CodecFactory;
import com.syt.mina.handler.DispacherHandler;

public class Sytserver {
	 private static final int PORT = 8880;

     public static void main(String[] args) throws IOException {
    	 
             IoAcceptor acceptor = new NioSocketAcceptor();
             acceptor.getFilterChain().addLast("logger", new LoggingFilter());
             acceptor.getFilterChain().addLast(
                             "codec",
                             new ProtocolCodecFilter( new TextLineCodecFactory() ));

             acceptor.setHandler(new SytHandler());
             acceptor.getSessionConfig().setReadBufferSize(2048);
             acceptor.getSessionConfig().setIdleTime(IdleStatus.BOTH_IDLE, 60);
             acceptor.bind(new InetSocketAddress(PORT));
             
     }
}
